Repository navigation
fix(ui): the OWD overview's draft save goes through the draft guard - #37554
Merged
Merged
Conversation
Each row's draft save is pinned to the draft read of the load the edit was made on, so a draft written since, or one that appeared after the load, is refused and asked about instead of overwritten or published unseen. The per-row basis is keyed by package and name, dropped once the row's publish lands, and loads are sequenced. Claude-Session: https://claude.ai/code/session_01L6bhgUnCu5Y93VusJhmEVm Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUnCu5Y93VusJhmEVm Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Nov 26, 2026
Contributor
Author
|
repo:objectstack#2 · os-sales · session_01L6bhgUnCu5Y93VusJhmEVm Final head for L1: CI on Generated by Claude Code |
Contributor
Author
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head f0bb20d · card #37515 · 2026-11-26T13:45ZL1 checklist
Tier: S. Landing: ready + auto-merge by this stroke. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Sales · project thread
Fixes #37515
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
PackageOwdOverviewPanel(the package-wide org-wide sharing default overview) wrote each changed row's draft with a plainclient.save: a whole-document PUT over a read taken at Save time, with no precondition. The publish after it was already pinned (#36962), but the live row does not move in either race below, so that pin caught neither:Now the draft write goes through the same guard the Studio editors use since #36726:
readDraftForSaveat the package the save writes (?package=; the old read named no package, whose answer pins nothing for a package-scoped save). Its pin, the draft body it served and the published pin are the row's basis (RowBasis).guard.save, pinned to it:If-Matchthe load's draft version, orIf-None-Match: *when the load read none. A draft written since, or one that appeared after the load, is refused409 METADATA_CONFLICTand the Studio save goes live: two admins saving the same published object, the later save silently overwrites the earlier one (the published layer has no version a save can pin) #36601 dialog asks (reload, overwrite after a confirmation, keep editing). A row with no pending draft still takes its published baseline from a Save-time/layersread, which the publish pin holds.editPinsRefholds the whole basis, keyed by package + name, is rebuilt by each installed load from its own rows (a kept edit keeps the basis it was made on), follows the draft the Save wrote (receipt pin, or no draft once a refused publish took it back), and drops the row's entry once its publish lands (the guard then holds the publish receipt, and nothing stale is re-sent over it).403(a draft this session may not read) is no longer read as "no draft": the Save refuses that row with the existing "draft you are not allowed to read" text instead of writing a body seeded from the published layer over it.Small decisions taken here (listed per the dev-thread rule)
/layersread failed publishes unpinned) is kept as is. It is the convention every Studio editor shares (readPublishedPinanswers no pin for a failed read), so changing it for this one surface would fork that convention, and refusing the publish changes shipped behaviour, which is not a dev-thread call. The draft half is now guarded whatever the/layersread did.Tests
New file
PackageOwdOverviewPanel.draftPinned-37515.test.tsx, a server double whose draft door enforcesIf-Match/If-None-Match: *and whose refusals are parsed by the realMetadataClient:/layersread); "overwrite" asks again, re-sends pinned to the refusal'scurrentVersion, and publishes the author's version;versiongets an unpinned save, as before;PackageOwdOverviewPanel.sharedSelect-11865.test.tsxpins the exact save options; its expectation now includesifNoneMatch: '*'(those rows load with no draft).Suite and ablations (at f0bb20d for the suite; ablations on the committed fix 7b0a3b7, each restored to HEAD by `ablation-replace`)
PackageOwdOverviewPanel*test files: 70 passed.recordRead(..., basis.draft)changed tonull): 8 of the 9 new non-sequencing tests red (every race and pin assertion); the no-versioncontrol and the sequencing test stay green, as expected.if (!current()) return false;deleted): the sequencing test red, 20 others green.priorforcedundefined): 4 red (the new kept-edit and sequencing tests, and two Studio OWD overview Save still publishes unpinned, so two admins saving the same object's sharing default, the later save silently overwrites the earlier #36962 kept-edit tests).Acceptance notes
/layersread of a row with no pending draft fails, the draft is built on an empty baseline, as before this PR. The draft door's destructive-change guard is expected to refuse such a body for an object with fields; nothing here changes that path.Verification
Two-minute check:
pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/PackageOwdOverviewPanel.draftPinned-37515.test.tsx(expect 10 passed).Read first, by risk: the
doSaveloop inPackageOwdOverviewPanel.tsx(basis selection, guarded save, basis updates after the save and the publish); thenload(sequencing and basis rebuild); thenreadObjectBodies/draftBasisOf.Local gates (at f0bb20d)
@object-ui/app-shelltype-check (tsc --noEmitandtsc -p tsconfig.test.json): exit 0, 0 errors.dispatch-gates.mjs --commandsderived list: all 38 derived families exit 0 (27 on the code tree at 7b0a3b7 before the changeset commit, the 11 changeset families the changeset added at f0bb20d);--ranreconciles 38 of 38Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses (touched files; repo-wide lint is CI's).main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Seat claim: 7192938485 on #37515 (Branch
claude/project-thread-vzymy4), written after this PR opened; this body edit re-runs the PR-body guards.Generated by Claude Code